#define _CRT_SECURE_NO_WARNINGS

#include"tree.h"


BTNode* BuyNode(BTDataType x)
{
	BTNode* node = (BTNode*)malloc(sizeof(BTNode));
	if (NULL == node)
	{
		perror("malloc fail");
		exit(-1);
	}

	node->_data = x;
	node->_left = node->_right = NULL;

	return node;
}

BTNode* CreatBinaryTree()
{
	BTNode* node1 = BuyNode(1);
	BTNode* node2 = BuyNode(2);
	BTNode* node3 = BuyNode(3);
	BTNode* node4 = BuyNode(4);
	BTNode* node5 = BuyNode(5);
	BTNode* node6 = BuyNode(6);


	node1->_left = node2;
	node1->_right = node4;
	node2->_left = node3;
	node4->_left = node5;
	node4->_right = node6;
	return node1;
}


int main()
{
	BTNode* tree = CreatBinaryTree();
	int ret  = BinaryTreeHight(tree);

	printf("%d", ret);
	return 0;
}